package Control;

/**
 *
 * @author Daniel Bustos
 */
public class DMAForecasting implements IForecasting {

    @Override
    public Double[] forecast(Double[] inputs) throws IllegalArgumentException {
        
        if(!Validator.validate(inputs))
            throw new IllegalArgumentException("The inputs' number must be equal or greater than 5.");
        
        SMAForecasting DMA = new SMAForecasting();
        
        // aux array for store the results of the first execution of SMAForecasting
        Double[] auxOutputs = new Double[inputs.length];
        
        // array for store the results of the second execution of SMAForecasting
        Double[] outputs = new Double[inputs.length];
        
        auxOutputs = DMA.forecast(inputs); // first call to SMAForecasting
        outputs = DMA.forecast(auxOutputs); // second call to SMAForecasting
        return outputs;
    }
}
